package com.action;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.service.EmpService;
import com.vo.ResponseBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

@RestController
@CrossOrigin("*")
@RequestMapping("/api")
public class EmpAction {

    @Autowired
    private EmpService empService;


    @RequestMapping("/searchEmp")
    public ResponseBean searchEmp(@RequestParam(defaultValue = "1") int page,@RequestParam(defaultValue = "10") int limit , Integer empId, String empName, String depName)
    {
          Map map = new HashMap();
          map.put("empId",empId);
          map.put("empName",empName);
          map.put("depName",depName);

          IPage result = empService.searchEmp(page,limit,map);
          return new ResponseBean(0,result.getTotal(),result.getRecords());
    }

}
